package com.cdpm.web.dto;

import java.util.ArrayList;
import java.util.List;

public enum ENUM_OFFLINE_ACTIVITY_TYPE {
    TXWJ("填写问卷","txwj"),
    HDBM("活动报名","hdbm"),
    HDCY("活动参与","hdcy"),
    WCHD("完成活动","wchd");
    private String label;
    private String value;

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    private ENUM_OFFLINE_ACTIVITY_TYPE(String label, String value) {
        this.label = label;
        this.value = value;
    }

    public static List<EnumInfoDTO> getEnumList(){
        List<EnumInfoDTO> enumInfoDTOS = new ArrayList<>();
        for(ENUM_OFFLINE_ACTIVITY_TYPE e: ENUM_OFFLINE_ACTIVITY_TYPE.values()){
            EnumInfoDTO enumInfoDTO = new EnumInfoDTO();
            enumInfoDTO.setLabel(e.getLabel());
            enumInfoDTO.setValue(e.getValue());
            enumInfoDTOS.add(enumInfoDTO);
        }
        return enumInfoDTOS;
    }

    public static String getLabelByValue(String value){
        String label = "";
        for(ENUM_OFFLINE_ACTIVITY_TYPE e: ENUM_OFFLINE_ACTIVITY_TYPE.values()){
            if(e.getValue().equals(value)){
                label = e.getLabel();
                break;
            }
        }
        return label;
    }

    public static String getValueByLabel(String label){
        String value = "";
        for(ENUM_OFFLINE_ACTIVITY_TYPE e: ENUM_OFFLINE_ACTIVITY_TYPE.values()){
            if(e.getLabel().equals(label)){
                value = e.getValue();
                break;
            }
        }
        return value;
    }
}
